<?php include 'header.php'; 
function navi_menu($self)
{
	$main=array('软件教研室首页',
				'教研室介绍',
				'教研室成员',
				'研究方向',
				'发表的论文',
				'教研室项目',
				'著作成果',
				'获得的奖励',
				'教学信息',
				'编译原理精品课',
				'高级程序设计精品课');
	$link_main=array('/home/index',
				'/home/intro',
				'/member/index',
				'/home/interest',
				'/paper/index',
				'/home/project',
				'/home/book',
				'/home/award',
				'/education/index',
				'/education/compiler',
				'/education/programming');

	$sub=array('新闻、最新动态',
				'内部通知',
				'课件、资料下载');
	$link_sub=array('/info/news',
				'/info/notice',
				'/info/resource');

	// main menu
	echo "<ul>\n";
	foreach ($main as $key => $val) {
		$l=$link_main[$key];
		if ('/'.$self->controller.'/'.$self->action==$l)
			$sel=' class="sel" ';
		else
			$sel=' ';
		echo "<li><a $sel href='$l'>$val</a></li>\n";
	}
	echo "</ul>\n";

	// sub menu
	echo "<ul>\n";
	foreach ($sub as $key => $val) {
		$l=$link_sub[$key];
		if ('/'.$self->controller.'/'.$self->action==$l)
			$sel=' class="sel" ';
		else
			$sel=' ';
		echo "<li><a $sel href='$l'>$val</a></li>\n";
	}
	echo "</ul>\n";
}

function panel($self)
{
	$login=Zend_Registry::get('login');
	if ($login==-1) { // 未登录，显式登录框
		$url=$_SERVER["REQUEST_URI"];
		echo "<form action='/member/login' method='post'>
			<h3>实验室成员登录</h3>
			<input type='hidden' name='url' 
				value='$url' />
			<p class='input'>用户名：<input type='text'
				name='User' value='' /></p>
			<p class='input'>密　码：<input type='password'
				name='Pass' value='' /></p>
			<p class='button'>
				<input type='submit' value='登录' /> | 
				<a href='###' style='font-size:12px;'>忘记密码了？</a>
			</p>
			</form>";
	}
	else { // 已登录
		$aid=$login['AId'];
		$name=$login['Name'];
		$priv=$login['Priv'];
		echo "<h3>个人面板</h3>
			<p>欢迎 <a href='javascript:show_member($aid);'>$name</a> 登录！</p>
			<ol><li>个人信息 <a href='/member/edit/AId/$aid'>修改&raquo;</a></li>
				<li>论　　文
					<a href='/member/paper/AId/$aid'>管理&raquo;</a></li>\n";
		if ($priv>1) {
			echo "<li>主页空间
					<a href='/member/teacher'>修改&raquo;</a></li>";
			echo "<li><hr /></li>
				<li><a href='javascript:add_news();'>发布新闻&raquo;</a></li>
				<li><a href='javascript:add_notice();'>发布内部通知&raquo;</a></li>
				<li><a href='/education'>教学信息 &raquo;</a></li>";
		}
		if (0) {
			echo "<li><hr /></li>
				<li><a href='/paper'>实验室论文&raquo;</a></li>
				<li><a href='/projects'>实验室项目&raquo;</a></li>
				<li><a href='/awards'>实验室奖励&raquo;</a></li>
				<li><a href='/books'>实验室著作&raquo;</a></li>
				<li><a href='/member'>成员管理&raquo;</a></li>";
		}
		$admin = array();
		@ include 'static/admin.php';
		if (auth::check(auth::PRIV_ADMIN) || 
					array_key_exists(auth::aid(), $admin)) {
				echo "<li><hr /></li>
					  <li><a href='/home/admin'>管理网站&raquo;</a></li>";
		}
		echo "<li><hr /></li>
				<li><a href='javascript:change_pass($aid);'>修改密码&raquo;</a>&nbsp;
					<a href='/member/logout'>退出登录&raquo;</a></li>
			</ol>\n";
	} // end of if
}
?>

<div id="sitename">
	<h1>吉林大学软件教研室 SoftLab. of JLU</h1>
</div> <!-- end of sitename -->

<div id="header">
	<div class="border">
		<div id="header_inner"><img id="banner" src="/pub/image/banner1.jpg"
				alt="Picture of softlab" width="760" height="110" /></div>
	</div>
</div> <!-- end of header -->

<div id="holder">

	<div id="navi">
		<div style="height:1.5em">&nbsp;</div>
		<?php navi_menu($this); ?>

		<div class="panel">
			<?php panel($this); ?>
		</div> <!-- end of panel -->

		<div id="jlu">
			<a href="http://www.jlu.edu.cn/" target="_blank"><img
				src="/pub/image/jlu.gif" alt="吉林大学校徽" /></a>
		</div>

		<div class="clear"></div>
	</div> <!-- end of navi -->

	<div id="right">

